﻿let main = 
    fun inName outName ->
        let commandLineSpecs =
            ["-i", ArgType.String (fun s -> inName := s), "Input file name";
             "-o", ArgType.String (fun s -> outName := s), "Output file name"
                ] |> List.map (fun (shortcut, argtype, description) -> ArgInfo(shortcut, argtype, description))
        let commandLineArgs = System.Environment.GetCommandLineArgs()
        ArgParser.Parse commandLineSpecs
    
        let start = System.DateTime.Now
        let result = Parser.Run !inName 
        let fin = System.DateTime.Now
        //printfn "%s" (System.IO.File.ReadAllText @"..\..\test.c")
        use output = new System.IO.StreamWriter(!outName)
        fprintfn output "Result: %A\nTotal time:%A" (result) (fin - start)
     
do main (ref @"..\..\test.c") (ref @"..\..\result.out")